<template>
    <view class="bg-content">
        <u-cell-group v-if="tbCommunityHomeConfig">
            <u-cell-item title="是否显示广告" :arrow="false" use-label-slot>
                <view slot="label">
                </view>
                <view>
                    {{tbCommunityHomeConfig.isShowAd ? '是': '否'}}
                </view>
            </u-cell-item>
            <u-cell-item title="广告高度" :arrow="false" use-label-slot>
                <view slot="label">
                </view>
                <view>
                    {{tbCommunityHomeConfig.adHeight}}
                </view>
            </u-cell-item>
            <adView ref="adComponentRef" :fkId="tbCommunityHomeConfig.id" v-if="tbCommunityHomeConfig.isShowAd"></adView>

            <u-cell-item title="是否显示二级系统分类" :arrow="false" use-label-slot>
                <view slot="label">
                </view>
                <view>
                    {{tbCommunityHomeConfig.isShowSystemClassLevel2 ? '是' : '否'}}
                </view>
            </u-cell-item>
            <systemClassLevel2MenusModule v-if="tbCommunityHomeConfig.isShowSystemClassLevel2"></systemClassLevel2MenusModule>

            <u-cell-item title="是否显示秒杀商品" :arrow="false" use-label-slot>
                <view slot="label">
                </view>
                <view>
                    {{tbCommunityHomeConfig.isShowSeckillGoods ? '是' : '否'}}
                </view>
            </u-cell-item>
            <u-cell-item title="商品秒杀活动标题" :arrow="false" use-label-slot>
                <view slot="label">
                </view>
                <view>
                    {{tbCommunityHomeConfig.seckillGoodsTitle}}
                </view>
            </u-cell-item>
            <seckillGoodsModule v-if="tbCommunityHomeConfig.isShowSeckillGoods"
                                :seckillGoodsTitle="tbCommunityHomeConfig.seckillGoodsTitle"></seckillGoodsModule>

            <u-cell-item title="是否显示商品推荐" :arrow="false" use-label-slot>
                <view slot="label">
                </view>
                <view>
                    {{tbCommunityHomeConfig.isShowGoodsRecommend ? '是' : '否'}}
                </view>
            </u-cell-item>
            <u-cell-item title="商品推荐标题" :arrow="false" use-label-slot>
                <view slot="label">
                </view>
                <view>
                    {{tbCommunityHomeConfig.goodsRecommendTitle}}
                </view>
            </u-cell-item>
            <goodsRecommendView ref="goodsRecommendViewRef" :fkId="tbCommunityHomeConfig.id"
                                v-if="tbCommunityHomeConfig.isShowGoodsRecommend"></goodsRecommendView>

            <u-cell-item title="是否显示店铺推荐" :arrow="false" use-label-slot>
                <view slot="label">
                </view>
                <view>
                    {{tbCommunityHomeConfig.isShowStoreRecommend ? '是' : '否'}}
                </view>
            </u-cell-item>
            <u-cell-item title="店铺推荐模块标题" :arrow="false" use-label-slot>
                <view slot="label">
                </view>
                <view>
                    {{tbCommunityHomeConfig.storeRecommendTitle}}
                </view>
            </u-cell-item>
            <storeRecommendView ref="storeRecommendViewRef" :fkId="tbCommunityHomeConfig.id"
                                v-if="tbCommunityHomeConfig.isShowStoreRecommend"></storeRecommendView>
        </u-cell-group>

        <div style="height: 60px;"></div>

        <div class="custom-bottom-button">
            <label @click="navigateTo('/pages/sub/sub3-community-platform/community-platform/community-platform-home-config/community-platform-home-config-edit/index', null, tbCommunityHomeConfig)">
                编辑首页
            </label>
        </div>
    </view>
</template>

<script>

    import {TbCommunityHomeConfigService} from "@/dev/services/tb-store-sender.service";
    import adView from '@/pages/common/ad/view.vue'
    import systemClassLevel2MenusModule from '@/components/home-config/system-class-level2-menus-module.vue'
    import seckillGoodsModule from '@/components/home-config/seckill-goods-module/seckill-goods-module.vue'
    import goodsRecommendView from '@/pages/common/goods-recommend/view.vue'
    import storeRecommendView from '@/pages/common/store-recommend/view.vue'

    export default {
        data() {
            return {
                tbCommunityHomeConfig: null,
                tbAdList: [],
            }
        },
        components: {
            adView,
            systemClassLevel2MenusModule,
            seckillGoodsModule,
            goodsRecommendView,
            storeRecommendView,
        },
        onShow() {
            const _self = this;
            _self.tbCommunityHomeConfig = null;
            _self.$nextTick(() => {
                new TbCommunityHomeConfigService().findTbCommunityHomeConfigByCommunityId(this.globalVariable.userInfo.tbCommunity.id).then(result => {
                    _self.tbCommunityHomeConfig = result;
                    _self.$forceUpdate();
                });
            });
        },
        methods: {}
    }
</script>

<style lang="scss" scoped>
</style>
